package com.xiaoxing.salesclient.mvp.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jess.arms.utils.ArmsUtils;
import com.xiaoxing.salesclient.mvp.model.entity.ProductOrder;

import java.util.List;

import xiaoxing.com.salesclient.R;


public class DingGouDanAdapter extends BaseQuickAdapter<ProductOrder.DataBean, BaseViewHolder> {

    private Context mContext;
    private String mOrderStatus;

    public DingGouDanAdapter(Context context, @Nullable List<ProductOrder.DataBean> data) {
        super(R.layout.item_ding_gou_dan, data);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, ProductOrder.DataBean item) {

        helper.setText(R.id.tv_time, ArmsUtils.stampToDate(item.getCreate_time()));
        helper.setText(R.id.tv_title, item.getProduct_name());
        helper.setText(R.id.tv_phone, "");
        helper.setText(R.id.tv_name, item.getNick_name());
        helper.setText(R.id.tv_score, "金額：" + item.getTotal_amount() + "元");
        helper.setText(R.id.tv_num, "數量：" + item.getProduct_num());
        if (item.getStatus().equals("0")) {
            mOrderStatus = "未付款";
        } else if (item.getStatus().equals("1")) {
            mOrderStatus = "已付款";
        } else if (item.getStatus().equals("2")) {
            mOrderStatus = "已取消";
        }
        helper.setText(R.id.tv_zhi_fu_zhuang_tai, mOrderStatus);
    }

}
